package com.f5.management.dao;

import com.f5.management.entity.User;
import com.f5.management.entity.dto.RealEstateUserDto;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface UserDAO {
    User get(int id);

    User getByName(String username);
    @Insert("insert into user_management(id,rid,memberName,phone) " +
            "values(default,#{rid},#{memberName},#{phone})")
    int add(RealEstateUserDto realEstateUserDto);
    @Update("update user_management set phone = #{phone},memberName = #{memberName}" +
            "where rid = #{id}")
    int update(RealEstateUserDto realEstateUserDto);
    @Select("select rid from user_management where memberName like CONCAT('%',#{memberName},'%')")
    int findRidByName(String name);
}
